{{ ansible_managed | comment }}

server {
    listen {{ nginx_config_status_port | default('8080') }};
{% if nginx_config_status_access_log is defined %}
    access_log{{ ' off' if not nginx_config_status_access_log }}{{ (' ' + nginx_config_status_access_log.location) if nginx_config_status_access_log.location is defined }}{{ (' ' + nginx_config_status_access_log.name) if nginx_config_status_access_log.name is defined }};
{% endif %}
    location /nginx_status {
        stub_status on;
    }
{% if nginx_config_status_allow is defined %}
{% for address in nginx_config_status_allow %}
    allow {{ address }};
{% endfor %}
{% endif %}
{% if nginx_config_status_deny is defined %}
{% for address in nginx_config_status_deny%}
    deny {{ address }};
{% endfor %}
{% endif %}
}
